#include <stdint.h>
#include <terminal_Terminal.h>

/* cc --shared tsc.c -o libtsc.so */
JNIEXPORT jlong JNICALL Java_terminal_Terminal_readTimeStampCounter(JNIEnv * env, jobject obj) {
    uint32_t result_low;
    uint32_t result_high;
    uint64_t result;
    __asm__ __volatile__ ("rdtsc\n\t" : "=a" (result_low), "=d" (result_high));
    result=result_high;
    result<<=32;
    result+=result_low;
	return(result);
}

